<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!-- /fasttmp/mkdist-qt-4.3.5-1211793125/qtopia-core-opensource-src-4.3.5/src/gui/widgets/qslider.cpp -->
<head>
  <title>Qt 4.3: QSlider Class Reference</title>
  <link href="classic.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="left" valign="top" width="32"><a href="http://www.trolltech.com/products/qt"><img src="images/qt-logo.png" align="left" width="32" height="32" border="0" /></a></td>
<td width="1">&nbsp;&nbsp;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&nbsp;&middot; <a href="classes.html"><font color="#004faf">All&nbsp;Classes</font></a>&nbsp;&middot; <a href="mainclasses.html"><font color="#004faf">Main&nbsp;Classes</font></a>&nbsp;&middot; <a href="groups.html"><font color="#004faf">Grouped&nbsp;Classes</font></a>&nbsp;&middot; <a href="modules.html"><font color="#004faf">Modules</font></a>&nbsp;&middot; <a href="functions.html"><font color="#004faf">Functions</font></a></td>
<td align="right" valign="top" width="230"><a href="http://www.trolltech.com"><img src="images/trolltech-logo.png" align="right" width="203" height="32" border="0" /></a></td></tr></table><h1 align="center">QSlider Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1>
<p>The QSlider widget provides a vertical or horizontal slider. <a href="#details">More...</a></p>
<pre> #include &lt;QSlider&gt;</pre><p>Inherits <a href="qabstractslider.html">QAbstractSlider</a>.</p>
<ul>
<li><a href="qslider-members.html">List of all members, including inherited members</a></li>
<li><a href="qslider-qt3.html">Qt 3 support members</a></li>
</ul>
<a name="public-types"></a>
<h3>Public Types</h3>
<ul>
<li><div class="fn"/>enum <b><a href="qslider.html#TickPosition-enum">TickPosition</a></b> { NoTicks, TicksBothSides, TicksAbove, TicksBelow, TicksLeft, TicksRight }</li>
</ul>
<a name="properties"></a>
<h3>Properties</h3>
<ul>
<li><div class="fn"/><b><a href="qslider.html#tickInterval-prop">tickInterval</a></b> : int</li>
<li><div class="fn"/><b><a href="qslider.html#tickPosition-prop">tickPosition</a></b> : TickPosition</li>
</ul>
<ul>
<li><div class="fn"/>11 properties inherited from <a href="qabstractslider.html#properties">QAbstractSlider</a></li>
<li><div class="fn"/>56 properties inherited from <a href="qwidget.html#properties">QWidget</a></li>
<li><div class="fn"/>1 property inherited from <a href="qobject.html#properties">QObject</a></li>
</ul>
<a name="public-functions"></a>
<h3>Public Functions</h3>
<ul>
<li><div class="fn"/><b><a href="qslider.html#QSlider">QSlider</a></b> ( QWidget * <i>parent</i> = 0 )</li>
<li><div class="fn"/><b><a href="qslider.html#QSlider-2">QSlider</a></b> ( Qt::Orientation <i>orientation</i>, QWidget * <i>parent</i> = 0 )</li>
<li><div class="fn"/><b><a href="qslider.html#dtor.QSlider">~QSlider</a></b> ()</li>
<li><div class="fn"/>void <b><a href="qslider.html#tickInterval-prop">setTickInterval</a></b> ( int <i>ti</i> )</li>
<li><div class="fn"/>void <b><a href="qslider.html#tickPosition-prop">setTickPosition</a></b> ( TickPosition <i>position</i> )</li>
<li><div class="fn"/>int <b><a href="qslider.html#tickInterval-prop">tickInterval</a></b> () const</li>
<li><div class="fn"/>TickPosition <b><a href="qslider.html#tickPosition-prop">tickPosition</a></b> () const</li>
</ul>
<ul>
<li><div class="fn"/>22 public functions inherited from <a href="qabstractslider.html#public-functions">QAbstractSlider</a></li>
<li><div class="fn"/>201 public functions inherited from <a href="qwidget.html#public-functions">QWidget</a></li>
<li><div class="fn"/>29 public functions inherited from <a href="qobject.html#public-functions">QObject</a></li>
<li><div class="fn"/>12 public functions inherited from <a href="qpaintdevice.html#public-functions">QPaintDevice</a></li>
</ul>
<a name="protected-functions"></a>
<h3>Protected Functions</h3>
<ul>
<li><div class="fn"/>void <b><a href="qslider.html#initStyleOption">initStyleOption</a></b> ( QStyleOptionSlider * <i>option</i> ) const</li>
</ul>
<ul>
<li><div class="fn"/>3 protected functions inherited from <a href="qabstractslider.html#protected-functions">QAbstractSlider</a></li>
<li><div class="fn"/>38 protected functions inherited from <a href="qwidget.html#protected-functions">QWidget</a></li>
<li><div class="fn"/>7 protected functions inherited from <a href="qobject.html#protected-functions">QObject</a></li>
<li><div class="fn"/>1 protected function inherited from <a href="qpaintdevice.html#protected-functions">QPaintDevice</a></li>
</ul>
<h3>Additional Inherited Members</h3>
<ul>
<li><div class="fn"/>2 public slots inherited from <a href="qabstractslider.html#public-slots">QAbstractSlider</a></li>
<li><div class="fn"/>19 public slots inherited from <a href="qwidget.html#public-slots">QWidget</a></li>
<li><div class="fn"/>1 public slot inherited from <a href="qobject.html#public-slots">QObject</a></li>
<li><div class="fn"/>6 signals inherited from <a href="qabstractslider.html#signals">QAbstractSlider</a></li>
<li><div class="fn"/>1 signal inherited from <a href="qwidget.html#signals">QWidget</a></li>
<li><div class="fn"/>1 signal inherited from <a href="qobject.html#signals">QObject</a></li>
<li><div class="fn"/>4 static public members inherited from <a href="qwidget.html#static-public-members">QWidget</a></li>
<li><div class="fn"/>5 static public members inherited from <a href="qobject.html#static-public-members">QObject</a></li>
<li><div class="fn"/>1 protected slot inherited from <a href="qwidget.html#protected-slots">QWidget</a></li>
</ul>
<a name="details"></a>
<hr />
<h2>Detailed Description</h2>
<p>The QSlider widget provides a vertical or horizontal slider.</p>
<p>The slider is the classic widget for controlling a bounded value. It lets the user move a slider handle along a horizontal or vertical groove and translates the handle's position into an integer value within the legal range.</p>
<p>QSlider has very few of its own functions; most of the functionality is in <a href="qabstractslider.html">QAbstractSlider</a>. The most useful functions are <a href="qabstractslider.html#value-prop">setValue</a>() to set the slider directly to some value; <a href="qabstractslider.html#triggerAction">triggerAction</a>() to simulate the effects of clicking (useful for shortcut keys); <a href="qabstractslider.html#singleStep-prop">setSingleStep</a>(), <a href="qabstractslider.html#pageStep-prop">setPageStep</a>() to set the steps; and <a href="qabstractslider.html#minimum-prop">setMinimum</a>() and <a href="qabstractslider.html#maximum-prop">setMaximum</a>() to define the range of the scroll bar.</p>
<p>QSlider provides methods for controlling tickmarks. You can use <a href="qslider.html#tickPosition-prop">setTickPosition</a>() to indicate where you want the tickmarks to be, <a href="qslider.html#tickInterval-prop">setTickInterval</a>() to indicate how many of them you want. the currently set tick position and interval can be queried using the <a href="qslider.html#tickPosition-prop">tickPosition</a>() and <a href="qslider.html#tickInterval-prop">tickInterval</a>() functions, respectively.</p>
<p>QSlider inherits a comprehensive set of signals:</p>
<p><table align="center" cellpadding="2" cellspacing="1" border="0">
<thead><tr valign="top" class="qt-style"><th>Signal</th><th>Description</th></tr></thead>
<tr valign="top" class="odd"><td><a href="qabstractslider.html#valueChanged">valueChanged</a>()</td><td>Emitted when the slider's value has changed. The tracking() determines whether this signal is emitted during user interaction.</td></tr>
<tr valign="top" class="even"><td><a href="qabstractslider.html#sliderPressed">sliderPressed</a>()</td><td>Emitted when the user starts to drag the slider.</td></tr>
<tr valign="top" class="odd"><td><a href="qabstractslider.html#sliderMoved">sliderMoved</a>()</td><td>Emitted when the user drags the slider.</td></tr>
<tr valign="top" class="even"><td><a href="qabstractslider.html#sliderReleased">sliderReleased</a>()</td><td>Emitted when the user releases the slider.</td></tr>
</table></p>
<p>QSlider only provides integer ranges. Note that although QSlider handles very large numbers, it becomes difficult for users to use a slider accurately for very large ranges.</p>
<p>A slider accepts focus on Tab and provides both a mouse wheel and a keyboard interface. The keyboard interface is the following:</p>
<ul>
<li>Left/Right move a horizontal slider by one single step.</li>
<li>Up/Down move a vertical slider by one single step.</li>
<li>PageUp moves up one page.</li>
<li>PageDown moves down one page.</li>
<li>Home moves to the start (mininum).</li>
<li>End moves to the end (maximum).</li>
</ul>
<p><table width="100%" align="center" cellpadding="2" cellspacing="1" border="0">
<tr valign="top" class="odd"><td><img src="images/macintosh-slider.png" alt="Screenshot of a Macintosh slider" /></td><td>A slider shown in the <a href="gallery-macintosh.html">Macintosh widget style</a>.</td></tr>
<tr valign="top" class="even"><td><img src="images/windows-slider.png" alt="Screenshot of a Windows XP slider" /></td><td>A slider shown in the <a href="gallery-windowsxp.html">Windows XP widget style</a>.</td></tr>
<tr valign="top" class="odd"><td><img src="images/plastique-slider.png" alt="Screenshot of a Plastique slider" /></td><td>A slider shown in the <a href="gallery-plastique.html">Plastique widget style</a>.</td></tr>
</table></p>
<p>See also <a href="qscrollbar.html">QScrollBar</a>, <a href="qspinbox.html">QSpinBox</a>, <a href="qdial.html">QDial</a>, <a href="guibooks.html#fowler">GUI Design Handbook: Slider</a>, and <a href="widgets-sliders.html">Sliders Example</a>.</p>
<hr />
<h2>Member Type Documentation</h2>
<h3 class="fn"><a name="TickPosition-enum"></a>enum QSlider::TickPosition</h3>
<p>This enum specifies where the tick marks are to be drawn relative to the slider's groove and the handle the user moves.</p>
<p><table border="1" cellpadding="2" cellspacing="1" width="100%">
<tr><th width="25%">Constant</th><th width="15%">Value</th><th width="60%">Description</th></tr>
<tr><td valign="top"><tt>QSlider::NoTicks</tt></td><td align="center" valign="top"><tt>0</tt></td><td valign="top">Do not draw any tick marks.</td></tr>
<tr><td valign="top"><tt>QSlider::TicksBothSides</tt></td><td align="center" valign="top"><tt>3</tt></td><td valign="top">Draw tick marks on both sides of the groove.</td></tr>
<tr><td valign="top"><tt>QSlider::TicksAbove</tt></td><td align="center" valign="top"><tt>1</tt></td><td valign="top">Draw tick marks above the (horizontal) slider</td></tr>
<tr><td valign="top"><tt>QSlider::TicksBelow</tt></td><td align="center" valign="top"><tt>2</tt></td><td valign="top">Draw tick marks below the (horizontal) slider</td></tr>
<tr><td valign="top"><tt>QSlider::TicksLeft</tt></td><td align="center" valign="top"><tt>TicksAbove</tt></td><td valign="top">Draw tick marks to the left of the (vertical) slider</td></tr>
<tr><td valign="top"><tt>QSlider::TicksRight</tt></td><td align="center" valign="top"><tt>TicksBelow</tt></td><td valign="top">Draw tick marks to the right of the (vertical) slider</td></tr>
</table></p>
<hr />
<h2>Property Documentation</h2>
<h3 class="fn"><a name="tickInterval-prop"></a>tickInterval : int</h3>
<p>This property holds the interval between tickmarks.</p>
<p>This is a value interval, not a pixel interval. If it is 0, the slider will choose between <a href="qabstractslider-qt3.html#lineStepx">lineStep</a>() and <a href="qabstractslider.html#pageStep-prop">pageStep</a>().</p>
<p>The default value is 0.</p>
<p>Access functions:</p>
<ul>
<li><div class="fn"/><b>int tickInterval () const</b></li>
<li><div class="fn"/><b>void setTickInterval ( int <i>ti</i> )</b></li>
</ul>
<p>See also <a href="qslider.html#tickPosition-prop">tickPosition</a>, <a href="qabstractslider-qt3.html#lineStepx">lineStep</a>(), and <a href="qabstractslider.html#pageStep-prop">pageStep</a>().</p>
<h3 class="fn"><a name="tickPosition-prop"></a>tickPosition : <a href="qslider.html#TickPosition-enum">TickPosition</a></h3>
<p>This property holds the tickmark position for this slider.</p>
<p>The valid values are described by the <a href="qslider.html#TickPosition-enum">QSlider::TickPosition</a> enum.</p>
<p>The default value is <a href="qslider.html#TickPosition-enum">QSlider::NoTicks</a>.</p>
<p>Access functions:</p>
<ul>
<li><div class="fn"/><b>TickPosition tickPosition () const</b></li>
<li><div class="fn"/><b>void setTickPosition ( TickPosition <i>position</i> )</b></li>
</ul>
<p>See also <a href="qslider.html#tickInterval-prop">tickInterval</a>.</p>
<hr />
<h2>Member Function Documentation</h2>
<h3 class="fn"><a name="QSlider"></a>QSlider::QSlider ( <a href="qwidget.html">QWidget</a> * <i>parent</i> = 0 )</h3>
<p>Constructs a vertical slider with the given <i>parent</i>.</p>
<h3 class="fn"><a name="QSlider-2"></a>QSlider::QSlider ( <a href="qt.html#Orientation-enum">Qt::Orientation</a> <i>orientation</i>, <a href="qwidget.html">QWidget</a> * <i>parent</i> = 0 )</h3>
<p>Constructs a slider with the given <i>parent</i>. The <i>orientation</i> parameter determines whether the slider is horizontal or vertical; the valid values are <a href="qt.html#Orientation-enum">Qt::Vertical</a> and <a href="qt.html#Orientation-enum">Qt::Horizontal</a>.</p>
<h3 class="fn"><a name="dtor.QSlider"></a>QSlider::~QSlider ()</h3>
<p>Destroys this slider.</p>
<h3 class="fn"><a name="initStyleOption"></a>void QSlider::initStyleOption ( <a href="qstyleoptionslider.html">QStyleOptionSlider</a> * <i>option</i> ) const&nbsp;&nbsp;<tt> [protected]</tt></h3>
<p>Initialize <i>option</i> with the values from this <a href="qslider.html">QSlider</a>. This method is useful for subclasses when they need a <a href="qstyleoptionslider.html">QStyleOptionSlider</a>, but don't want to fill in all the information themselves.</p>
<p>See also <a href="qstyleoption.html#initFrom">QStyleOption::initFrom</a>().</p>
<p /><address><hr /><div align="center">
<table width="100%" cellspacing="0" border="0"><tr class="address">
<td width="30%">Copyright &copy; 2008 <a href="trolltech.html">Trolltech</a></td>
<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
<td width="30%" align="right"><div align="right">Qt 4.3.5</div></td>
</tr></table></div></address></body>
</html>
